package com.smart.campus.web.controller.student;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.smart.campus.common.annotation.Log;
import com.smart.campus.common.core.controller.BaseController;
import com.smart.campus.common.core.domain.AjaxResult;
import com.smart.campus.common.core.page.TableDataInfo;
import com.smart.campus.common.enums.BusinessType;
import com.smart.campus.common.utils.DateUtils;
import com.smart.campus.common.utils.poi.ExcelUtil;
import com.smart.campus.school.domain.ClassInfo;
import com.smart.campus.school.domain.IllegalRecord;
import com.smart.campus.school.domain.query.IllegalRecordQuery;
import com.smart.campus.school.domain.vo.IllegalRecordReportVo;
import com.smart.campus.school.domain.vo.IllegalRecordVo;
import com.smart.campus.school.service.IClassInfoService;
import com.smart.campus.school.service.IGradeService;
import com.smart.campus.school.service.IIllegalRecordService;
import com.smart.campus.web.utils.SchoolUtil;
import com.smart.campus.web.utils.StudentUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.*;
import java.util.stream.Collectors;

/**
 * 违规记录Controller
 * 
 * @author Zhihe.Li
 * @date 2020-05-25
 */
@Controller
@RequestMapping("/student/illegalRecord")
public class StudentIllegalRecordController extends BaseController
{
    private String prefix = "student/illegalRecord";

    @Autowired
    private IIllegalRecordService illegalRecordService;

    @GetMapping()
    public String illegalRecord()
    {
        return prefix + "/illegalRecord";
    }

    /**
     * 查询违规记录列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(IllegalRecordQuery query)
    {
        startPage();
        query.setStudentId(StudentUtil.getStudentId());
        List<IllegalRecordVo> list = illegalRecordService.selectIllegalRecordList(query);
        return getDataTable(list);
    }


}
